<?php

/**
 * AcctVoucherH form base class.
 *
 * @method AcctVoucherH getObject() Returns the current form's model object
 *
 * @package    tinystockmis
 * @subpackage form
 * @author     Linfeng Wu
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 24171 2009-11-19 16:37:50Z Kris.Wallsmith $
 */
abstract class BaseAcctVoucherHForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'            => new sfWidgetFormInputHidden(),
      'voucher_sn'    => new sfWidgetFormInputText(),
      'acct_set_id'   => new sfWidgetFormInputText(),
      'acct_year'     => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('AcctYear'), 'add_empty' => false)),
      'acct_mon'      => new sfWidgetFormInputText(),
      'date'          => new sfWidgetFormDate(),
      'debit_amount'  => new sfWidgetFormInputText(),
      'credit_amount' => new sfWidgetFormInputText(),
      'is_approved'   => new sfWidgetFormInputText(),
      'is_posted'     => new sfWidgetFormInputText(),
      'is_cancelled'  => new sfWidgetFormInputText(),
      'opr'           => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('RltOpr'), 'add_empty' => false)),
      'approve_opr'   => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('RltApproveOpr'), 'add_empty' => true)),
      'post_opr'      => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('RltPostOpr'), 'add_empty' => true)),
      'cancel_opr'    => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('RltCancelOpr'), 'add_empty' => true)),
      'approve_date'  => new sfWidgetFormDate(),
      'post_date'     => new sfWidgetFormDate(),
      'cancel_date'   => new sfWidgetFormDate(),
      'created_at'    => new sfWidgetFormDateTime(),
      'updated_at'    => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'            => new sfValidatorDoctrineChoice(array('model' => $this->getModelName(), 'column' => 'id', 'required' => false)),
      'voucher_sn'    => new sfValidatorString(array('max_length' => 45, 'required' => false)),
      'acct_set_id'   => new sfValidatorInteger(array('required' => false)),
      'acct_year'     => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('AcctYear'))),
      'acct_mon'      => new sfValidatorInteger(),
      'date'          => new sfValidatorDate(array('required' => false)),
      'debit_amount'  => new sfValidatorNumber(),
      'credit_amount' => new sfValidatorNumber(),
      'is_approved'   => new sfValidatorInteger(array('required' => false)),
      'is_posted'     => new sfValidatorInteger(array('required' => false)),
      'is_cancelled'  => new sfValidatorInteger(array('required' => false)),
      'opr'           => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('RltOpr'))),
      'approve_opr'   => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('RltApproveOpr'), 'required' => false)),
      'post_opr'      => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('RltPostOpr'), 'required' => false)),
      'cancel_opr'    => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('RltCancelOpr'), 'required' => false)),
      'approve_date'  => new sfValidatorDate(array('required' => false)),
      'post_date'     => new sfValidatorDate(array('required' => false)),
      'cancel_date'   => new sfValidatorDate(array('required' => false)),
      'created_at'    => new sfValidatorDateTime(),
      'updated_at'    => new sfValidatorDateTime(),
    ));

    $this->widgetSchema->setNameFormat('acct_voucher_h[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'AcctVoucherH';
  }

}
